﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterCRM.master" AutoEventWireup="true" CodeFile="CallSearchAdvance.aspx.cs" Inherits="CallSearchAdvance" %>
<%@ MasterType VirtualPath="~/MasterCRM.master"%>

<%@ Register src="UC/AddCallUC.ascx" tagname="AddCallsUC" tagprefix="uc" %>
<%@ Register src="UC/CallSatusUC.ascx" tagname="CallSatusUC" tagprefix="uc" %>
<%@ Register src="UC/SearchCritetia.ascx" tagname="SearchCritetia" tagprefix="uc" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script language="javascript" type="text/javascript">
    var css = "css/style.css";
  </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">             
    <div id="stylized" class="myform" style="overflow:hidden;">
    <uc:SearchCritetia ID="ucscCallSC" runat="server" />
    
    <div id="mGrid" >
      <asp:GridView ID="gvAdvanceSearchResult" runat="server" AutoGenerateColumns="False"
        GridLines="None" AllowPaging="true" Width="1210px" PageSize="25" CssClass="mGrid"
        AlternatingRowStyle-CssClass="alt" PagerStyle-CssClass="pgr" PagerSettings-Mode="NumericFirstLast"
        DataKeyNames="ID" OnRowDataBound="gvAdvanceSearchResult_RowDataBound" 
        OnPageIndexChanging="gvAdvanceSearchResult_PageIndexChanging" 
         OnRowCommand="gvAdvanceSearchResult_RowCommand">
        <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
        <Columns>
          <asp:BoundField DataField="ID" HeaderText="CallID" ReadOnly="True" ItemStyle-Width="80px"
            SortExpression="ID">
            <ItemStyle Width="160px"></ItemStyle>
          </asp:BoundField>
          <asp:BoundField DataField="CallReceiveDate" HeaderText="Date" DataFormatString="{0:dd/MMM/yy}"
            ItemStyle-Width="60px">
            <ItemStyle Width="60px"></ItemStyle>
          </asp:BoundField>
          <asp:TemplateField HeaderText="Dealer" ItemStyle-Width="150px">
            <ItemTemplate>
              <%#Eval("Dealer.DealerName")%>
            </ItemTemplate>
            <ItemStyle Width="150px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Customer" ItemStyle-Wrap="false" ItemStyle-Width="120px">
            <ItemTemplate>
              <asp:Label ID="lnkCustomerName" runat="server" Text='<%#Eval("Customer.CustomerName")%>' Style="cursor: pointer;text-decoration: underline;font-weight:bold;" />
              <asp:HiddenField ID="hdnCallStatusID" runat="Server" Value='<%#Eval("CallStatus.ID")%>' />
              <asp:HiddenField ID="hdnCallTypeID" runat="Server" Value='<%#Eval("CallType.ID")%>' />
              <asp:HiddenField ID="hdnDealerID" runat="Server" Value='<%#Eval("Dealer.ID")%>' />
              <asp:HiddenField ID="hdnInstallerID" runat="Server" Value='<%#Eval("Installer.ID")%>' />  
              <asp:HiddenField ID="hdnAcBrandID" runat="Server" Value='<%#Eval("ACBrand.ID")%>' />
              <asp:HiddenField ID="hdnIsTempClosed" runat="Server" Value='<%#Eval("IsTempClosed")%>' />
              
              <asp:HiddenField ID="hdnInstallerCommisionCR" runat="Server" Value='<%#Eval("InstallerCommisionCR")%>' />
              <asp:HiddenField ID="hdnInstallerMaterialCR" runat="Server" Value='<%#Eval("InstallerMaterialCR")%>' />
              <asp:HiddenField ID="hdnInstallerAcDR" runat="Server" Value='<%#Eval("InstallerAcDR")%>' />  
              <asp:HiddenField ID="hdnDealerAcDR" runat="Server" Value='<%#Eval("DealerAcDR")%>' />
              <asp:HiddenField ID="hdnDealerAcCR" runat="Server" Value='<%#Eval("DealerAcCR")%>' />
                                                                                      
                         
              <asp:Panel ID="pnlEditCall" runat="server" Style="display: none; width: 1100px;" CssClass="modalPopup">
                
                <div style=" overflow:scroll;height:600px;">                 
                  <uc:AddCallsUC ID="ucacSaveCall" runat="server"
                  CallID='<%#Eval("ID")%>'
                  CallReceiveDate='<%# null != Eval("CallReceiveDate") ? Eval("CallReceiveDate", "{0:dd/MMM/yy}").ToString() : string.Empty %>'                                     
                  ACModelNo='<%#Eval("ACModelNo")%>'  
                  ACPurchasedDate='<%# Eval("ACPurchasedDate")%>'
                  ACSerialNo='<%#Eval("ACSerialNo")%>'
                  Comment='<%#Eval("Remarks")%>'

                  CallScheduledDate='<%# Eval("CallScheduledDate") %>'

                  CustomerID='<%#Eval("Customer.ID")%>'
                  CustomerName='<%#Eval("Customer.CustomerName")%>'
                  Address='<%#Eval("Customer.Address")%>'                  
                  MobileNo1='<%#Eval("Customer.MobileNo1")%>'
                  MobileNo2='<%#Eval("Customer.MobileNo2")%>'
                  Mode="Edit"
                  PhoneNo='<%#Eval("Customer.PhoneNo")%>'
                  ZipCode='<%#Eval("Customer.ZipCode")%>'/>

                  <asp:Button ID="btnSave" runat="server" CommandName="Save" ValidationGroup="submit"  Text="Save" style="float:left;"/>
                  <asp:Button ID="btnCancel" runat="server" Text="Cancel" style="float:left;" />
                </div>                
              </asp:Panel>
              <ajaxToolkit:ModalPopupExtender ID="popupEditCall" runat="server" TargetControlID="lnkCustomerName"
                 PopupControlID="pnlEditCall" BackgroundCssClass="modalBackground" CancelControlID="btnCancel" 
                DropShadow="true" />
            </ItemTemplate>            
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Address" ItemStyle-Width="50px">
            <ItemTemplate>
              <asp:Label ID="lblAddress" runat="server" Text="Address" Style="cursor: pointer;
                text-decoration: underline;"></asp:Label>
              <asp:Panel ID="pnlAddress" runat="server" Style="font-size: 11px;">
                <%#Eval("Customer.Address")%>
              </asp:Panel>
              <ajaxToolkit:BalloonPopupExtender ID="popAddress" runat="server" TargetControlID="lblAddress"
                BalloonPopupControlID="pnlAddress" Position="BottomRight" BalloonStyle="Rectangle"
                BalloonSize="Medium" UseShadow="false" DisplayOnClick="true" DisplayOnFocus="true" />
            </ItemTemplate>
            <ItemStyle Width="50px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Zip Code" ItemStyle-Width="40px">
            <ItemTemplate>
              <%#Eval("Customer.ZipCode")%>
            </ItemTemplate>
            <ItemStyle Width="40px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Phone" ItemStyle-Width="60px">
            <ItemTemplate>
              <%#Eval("Customer.PhoneNo")%>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Mobile1" ItemStyle-Width="60px">
            <ItemTemplate>
              <%#Eval("Customer.MobileNo1")%>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Mobile2" ItemStyle-Width="60px">
            <ItemTemplate>
              <%#Eval("Customer.MobileNo2")%>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Status" ItemStyle-Width="60px">
            <ItemTemplate>
              <asp:Label ID="lblStatus" runat="server" Text='<%#Eval("CallStatus.StatusName")%>'></asp:Label>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Apt. Date" ItemStyle-Width="90px" HeaderStyle-Wrap="true">
            <ItemTemplate>
              <asp:Label ID="lblScheduledDate" runat="server" Text='<%# null != Eval("CallScheduledDate") ? Eval("CallScheduledDate", "{0:dd/MMM/yy}").ToString() : string.Empty %>'></asp:Label>
            </ItemTemplate>
            <HeaderStyle Wrap="True"></HeaderStyle>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Installer" ItemStyle-Width="110px">
            <ItemTemplate>
              <asp:Label ID="lblInstaller" runat="server" Text=' <%#Eval("Installer.InstallerName")%>'></asp:Label>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Complt. DT" ItemStyle-Width="60px">
            <ItemTemplate>
              <%# null != Eval("CallCompletedDate") ? Eval("CallCompletedDate", "{0:dd/MMM/yy}").ToString() : string.Empty%>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Comment" ItemStyle-Width="60px">
            <ItemTemplate>
              <%#Eval("Comment")%>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Click" ItemStyle-Width="50px">
            <ItemTemplate>
              <asp:Label ID="lblComment" runat="server" Text="More" Style="cursor: pointer;
                text-decoration: underline;"></asp:Label>
              <asp:Panel ID="pnlPreviousComment" runat="server" Style="font-size: 11px; height: 50px;">
                <%#Eval("Remarks")%>
              </asp:Panel>
              <ajaxToolkit:BalloonPopupExtender ID="popComment" runat="server" TargetControlID="lblComment"
                BalloonPopupControlID="pnlPreviousComment" Position="BottomLeft" BalloonStyle="Rectangle"
                BalloonSize="Large" UseShadow="false" DisplayOnClick="true" DisplayOnFocus="true" />
            </ItemTemplate>
            <ItemStyle Width="50px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Updated By" ItemStyle-Width="90px" ItemStyle-ForeColor="#666666">
            <ItemTemplate>
              <%#Eval("LastModifiedUser.UserName")%>
            </ItemTemplate>
            <ItemStyle Width="90px"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Updated on" ItemStyle-Width="60px" ItemStyle-ForeColor="#666666">
            <ItemTemplate>
              <%# null != Eval("LastModifiedDateTime") ? Eval("LastModifiedDateTime", "{0:dd/MMM/yy}").ToString() : string.Empty%>
            </ItemTemplate>
            <ItemStyle Width="60px"></ItemStyle>            
          </asp:TemplateField>
          
        </Columns>
        <PagerSettings Mode="NumericFirstLast"></PagerSettings>
        <PagerStyle CssClass="pgr"></PagerStyle>
      </asp:GridView>
        
    </div>
  </div>   
  
              
            
            
    <script type="text/javascript">
      // The following snippet works around a problem where FloatingBehavior
      // doesn't allow drops outside the "content area" of the page - where "content
      // area" is a little unusual for our sample web pages due to their use of CSS
      // for layout.
      function setBodyHeightToContentHeight() {
        document.body.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) + "px";
      }
      setBodyHeightToContentHeight();
      $addHandler(window, "resize", setBodyHeightToContentHeight);    
    </script> 
</asp:Content>

